package com.chendk.controller;

import com.chendk.entity.TestTable;
import com.chendk.service.TestTableService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Capc on 2017/6/9.
 */
@RestController
@RequestMapping(value = "/test")
public class TestTableController {

    @Autowired
    private TestTableService tableService;

    @RequestMapping(value = "/add" , method = RequestMethod.POST)
    public JSONObject addRecord(
            @RequestBody TestTable tt
    ) {
        JSONObject json = new JSONObject();
        if(tableService.addOne(tt)){
            json.put("status" , true);
        }else {
            json.put("status" , false);
        }
        return json;
    }
}
